package com.hudsonmq.spring.utils;

import io.netty.channel.Channel;
import io.netty.channel.ChannelFuture;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;


/**
 * @Author: 渔小鲤
 * @DateTime: 2025/7/7 22:43
 **/
public class NettyUtil {
    private static final Logger logger = LoggerFactory.getLogger(NettyUtil.class);

    public static ChannelFuture write(Channel channel, Object object) {
        if (channel != null && channel.isActive()) {
            return channel.writeAndFlush(object);
        } else {
            logger.warn("Channel 不可用，无法发送消息");
        }
        return null;
    }
}
